<?php
class Upload extends Controller {
    
    function Upload() {
        parent::Controller();

        $config['upload_path'] = './uploads/artwork/';
        $config['allowed_types'] = 'pdf';
        $config['max_size']    = '209715200'; //200MB  
	    //$config['max_size']    = '2097152'; //2MB  
        
        $this->load->library('upload', $config);
        $this->load->model('upload_artwork_model');	
    }
    
    function do_upload() 
    {
        $dir = './uploads/artwork/';
		
		$this->upload->do_upload('Filedata');
        
        $filedata = $this->upload->data();
        
        $path_parts = pathinfo($filedata['file_name']);
        
        $ext = strtolower($path_parts["extension"]);
        
        $filenames = $path_parts['filename'];
        
        //$filename= $filedata['file_name'].date("Y-m-d H:i:s");
        $filename= $filenames."_".date("Y-m-d_H:i:s").".".$ext;
        
		//rename($dir.$filedata['file_name'], $dir.$filename);
		
       // $this->upload_artwork_model->insert_uploads($filename);
		$this->upload_artwork_model->insert_uploads($filedata['file_name']);
		
		
    }
} 
?> 